import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StockLogVO, StockLogForm, StockLogQuery } from '@/api/wms/stockLog/types';

/**
 * 查询出入库记录列表
 * @param query
 * @returns {*}
 */

export const listStockLog = (query?: StockLogQuery): AxiosPromise<StockLogVO[]> => {
  return request({
    url: '/wms/stockLog/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询出入库记录详细
 * @param id
 */
export const getStockLog = (id: string | number): AxiosPromise<StockLogVO> => {
  return request({
    url: '/wms/stockLog/' + id,
    method: 'get'
  });
};

/**
 * 新增出入库记录
 * @param data
 */
export const addStockLog = (data: StockLogForm) => {
  return request({
    url: '/wms/stockLog',
    method: 'post',
    data: data
  });
};

/**
 * 修改出入库记录
 * @param data
 */
export const updateStockLog = (data: StockLogForm) => {
  return request({
    url: '/wms/stockLog',
    method: 'put',
    data: data
  });
};

/**
 * 删除出入库记录
 * @param id
 */
export const delStockLog = (id: string | number | Array<string | number>) => {
  return request({
    url: '/wms/stockLog/' + id,
    method: 'delete'
  });
};
